home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
422_01
/
libcf
/
string4.asm
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Assembly Source File
|
1994-03-27
|
355 b
|
15 lines
*
* Search for character in string: strchr(string, chr)
*
strchr LDI 4,S Get pointer to string
?1 LDB I Get character from string
JZ ?2 End of string
CMP 2,S Does it match?
JNZ ?3 Yes, we found it
LEAI 1,I Skip to next
SJMP ?1 No, keep looking
?2 CMP 2,S Are we looking for zero
JZ ?4 No, return 0
?3 TIA Get pointer
?4 RET